<div>
    <div id="addNewsForm" class="form-horizontal">


        <div class="form-group">
            <label class="col-lg-12 control-label">内容</label>
            <div class="col-lg-12">
                <input type="text" class="form-control" name="name" placeholder="内容" data-bv-field="name">

            </div>
        </div>



        <div class="form-group">
            <label class="col-lg-12 control-label">排序</label>
            <div class="col-lg-12">
                <input type="text" class="form-control" name="sortIndex" placeholder="排序" data-bv-field="sortIndex">

            </div>
        </div>

    </div>
</div>
<script>
    $(function () {

        if ('${message?if_exists}' != '') {
            toastr.error('${message?if_exists}');
        }

        $('#addNewsForm').bootstrapValidator({
            phones: 'This value is not valid',
            feedbackIcons: {
                valid: 'glyphicon glyphicon-ok',
                invalid: 'glyphicon glyphicon-remove',
                validating: 'glyphicon glyphicon-refresh'
            },
            fields: {
                sortIndex: {
                    message: '排序校验失败',
                    validators: {
                        notEmpty: {
                            message: '不能为空'
                        },
                        digits: {
                            message: '字段必须是正整数'
                        }
                    }
                },
                name: {
                    message: '内容校验失败',
                    validators: {
                        notEmpty: {
                            message: '不能为空'
                        },
                        stringLength: {
                            min: 2,
                            max: 50,
                            message: '长度2-50位字符'
                        }
                    }
                }

            }
        });

    });




    function ajaxSubmitForm() {


        var name = $('input[name="name"]').val();
        var sortIndex = $('input[name="sortIndex"]').val();
        var param = {
            'name': name,
            'sortIndex': sortIndex
        };
        var url = 'add';
        var resultInfo = ajaxPost(url, param, false);
        return resultInfo;
    }
</script>